<template>
  <div>
    <img
      src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1175281041,455427199&fm=26&gp=0.jpg"
      alt=""
    />
    <p @click="fn" :style="{ background: bgc }">这是哪路拖</p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      bgc: "",
    };
  },
  methods: {
    fn() {
      console.log(this.bgc);
      this.bgc = `rgb(${Math.floor(Math.random() * 256)},${Math.floor(
        Math.random() * 256
      )},${Math.floor(Math.random() * 256)})`;
    },
  },
};
</script>

<style  scoped>
div {
  border: 1px solid red;
  width: 300px;
  /* height: 100px; */
  text-align: center;
  float: left;
}
img {
  /* background-color: ; */
  width: 100%;
}
</style>>
